<script type="text/javascript">
function selectSelector()
{
    var car_id = '<?php echo $car_id ?>';
    $("#car-selector").val(car_id);
}

$(function(){   
    selectSelector();

    $("#car-selector").change(function() {
        //alert('tes');
        var car_id = $(this).val();
        location.href = "<?php echo base_url() ?>FCar/<?php echo $type ?>/" + car_id;
    });

});
</script>

<div class="car-detail block">
    <div class="car-desc">
        <div class="car-desc-block">
            <div class="container">
                <div class="car-desc-header">
                    <h1>Description</h1>
                    <a class="btn-find" href="#">Find A <span>Dealer</span></a>
                    <div class="row">
                        <div class="col-md-4">
                        <br><br>
                        Car Selector 
                        <select class="form-control" id="car-selector">
                            <?php 
                                foreach ($query_car->result() as $row) 
                                {
                            ?>
                                    <option value="<?php echo $row->car_id ?>"><?php echo $row->series_name ?></option>
                            <?php
                                }
                            ?>
                        </select>
                        </div>
                    </div>
                </div>

                <?PHP
                foreach ($query->result() as $row) 
                {
                    if($row->style == "The image on the right")
                    {
                ?>
                    <div class="row">
                        <div class="col-xs-12 col-sm-6 desc-left">
                            <h3><?PHP echo $row->title ?></h3>
                            <p>
                            <?PHP echo $row->content1 ?>
                            </p>
                        </div>
                        <div class="col-xs-12 col-sm-6 desc-right">
                            <img src="<?PHP echo base_url() ?>uploads/car_overview/<?PHP echo $row->image ?>">
                        </div>
                    </div>
                <?PHP
                    }
                    else
                    {
                ?>
                    <div class="row">
                        <div class="col-xs-12 col-sm-6 desc-left">
                            <img src="<?PHP echo base_url() ?>uploads/car_overview/<?PHP echo $row->image ?>">
                        </div>
                        <div class="col-xs-12 col-sm-6 desc-right">
                            <h3><?PHP echo $row->title ?></h3>
                            <p>
                            <?PHP echo $row->content1 ?>
                            </p>
                        </div>
                    </div>
                <?PHP
                    }
                }
                ?>
            </div>
        </div>
    </div>
</div>